<?php
//模型
class SportCatModel extends MY_Model {
	function __construct(){
		parent::__construct();
		$this->table = 'sport_cat';
	}
	
	function get_list(){
		$sql = "select * from ".$this->db->dbprefix.$this->table." where 1";
		$query = $this->db->query($sql);
		$res  = $query->result_array();
		
		return $res;
	}
	
	function name_is_exits($name){
		$sql = "select id from ".$this->db->dbprefix.$this->table." where name='{$name}' limit 1";
		$query = $this->db->query($sql);
		$row  = $query->row_array();
		
		return $row?1:0;
	}
}

